package zero.tech.games.log.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import zero.tech.games.entity.log.LogPlayback;
import zero.tech.games.log.data.res.ResPlayback;

public interface LogPlaybackMapper {

	void insertBatch(List<LogPlayback> list);

	@Select("select count(1) from log_playback where uid=#{uid} and club_id=#{club_id} and game_id=#{game_id} and create_stamp between #{begin} and #{end} ")
	int totalCount(@Param("uid")int uid, @Param("club_id")int club_id, @Param("game_id")int game_id,@Param("begin") Date begin, @Param("end")Date end);
	
	@Select("select uid,club_id,game_id,room_id,room_times,play_code,small,day_str,create_stamp from log_playback "
			+ "where uid=#{uid} and club_id=#{club_id} and game_id=#{game_id} and create_stamp between #{begin} and #{end} order by create_stamp desc "
			+ "limit #{start},#{pageLength}")
	List<ResPlayback> findLogPlaybackListByPage(int uid, int club_id, int game_id, int start,int pageLength,Date begin,Date end);

	@Select("select * from log_playback where uid=#{uid} and club_id=#{club_id} and game_id=#{game_id} and room_id=#{room_id} and play_code=#{play_code} and create_stamp between #{begin} and #{end}")
	LogPlayback getLogPlayback(int uid, int club_id, int game_id, String room_id, String play_code, Date begin, Date end);

}
